[HEADER]	
	VERSION		00.00.00.00	
	DESCRIPTION Anisotropic Lighting Example	
	COPYRIGHT	Imagination Technologies Ltd.	
[/HEADER]

[TEXTURES]
	FILE	anisotropicmap 	anisotropicmap.pvr		LINEAR-LINEAR-LINEAR
[/TEXTURES]

[VERTEXSHADER]
	NAME myVertShader
	[GLSL_CODE]
		attribute highp vec3	myVertex;
		attribute mediump vec3	myNormal;
		uniform mediump mat4	myMVPMatrix;
		uniform mediump mat3	myModelViewIT;
		const mediump vec3		myLightDirection = vec3(0.577,0.577,0.577);
		const mediump vec3		myEyePos = vec3(0.0,0.0,10.0);
		varying mediump vec2	texCoordinate;
		void main(void)
		{
			gl_Position = myMVPMatrix * vec4(myVertex,1);
			mediump vec3 transNormal = normalize(myModelViewIT * myNormal);
			
			mediump vec3 vertexToEye = normalize(myEyePos - myVertex);
			mediump vec3 halfAngle = normalize(vertexToEye + myLightDirection);
			
			texCoordinate.x = dot(myLightDirection, transNormal);
			texCoordinate.y = dot(halfAngle, transNormal);
		}
	[/GLSL_CODE]
[/VERTEXSHADER]

[FRAGMENTSHADER]
	NAME myFragShader
	[GLSL_CODE]
		uniform sampler2D		sampler2d;
		varying mediump vec2	texCoordinate;
		void main (void)
		{
			mediump vec3 texColour = vec3(texture2D(sampler2d, texCoordinate));
			gl_FragColor = vec4(texColour, 1.0);
		}
	[/GLSL_CODE]
[/FRAGMENTSHADER]

[EFFECT]
	NAME myEffect

	ATTRIBUTE	myVertex			POSITION	
	ATTRIBUTE	myNormal			NORMAL
	UNIFORM		myMVPMatrix			WORLDVIEWPROJECTION	
	UNIFORM		myModelViewIT		WORLDVIEWIT
	UNIFORM		sampler2d			TEXTURE0

	TEXTURE		0 anisotropicmap

	VERTEXSHADER myVertShader
	FRAGMENTSHADER myFragShader
[/EFFECT]
